.class public Lcom/instagram/creation/video/mediarecorder/m;
.super Ljava/lang/Object;
.source "PacketWriter.java"


# instance fields
.field private a:Landroid/os/Handler;

.field private b:Ljava/io/ByteArrayOutputStream;


# direct methods
.method public constructor <init>(Landroid/os/Handler;)V
    .locals 1
    .parameter

    .prologue
    .line 21
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 22
    new-instance v0, Ljava/io/ByteArrayOutputStream;

    invoke-direct {v0}, Ljava/io/ByteArrayOutputStream;-><init>()V

    iput-object v0, p0, Lcom/instagram/creation/video/mediarecorder/m;->b:Ljava/io/ByteArrayOutputStream;

    .line 23
    iput-object p1, p0, Lcom/instagram/creation/video/mediarecorder/m;->a:Landroid/os/Handler;

    .line 25
    return-void
.end method

.method static synthetic a(Lcom/instagram/creation/video/mediarecorder/m;)Ljava/io/ByteArrayOutputStream;
    .locals 1
    .parameter

    .prologue
    .line 14
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/m;->b:Ljava/io/ByteArrayOutputStream;

    return-object v0
.end method

.method public static a(Lcom/instagram/creation/video/mediarecorder/m;[BLorg/json/JSONObject;)V
    .locals 3
    .parameter
    .parameter
    .parameter

    .prologue
    .line 58
    :try_start_0
    invoke-virtual {p2}, Lorg/json/JSONObject;->toString()Ljava/lang/String;

    move-result-object v0

    const-string v1, "utf-8"

    invoke-virtual {v0, v1}, Ljava/lang/String;->getBytes(Ljava/lang/String;)[B
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v0

    .line 62
    :goto_0
    new-instance v1, Lcom/instagram/creation/video/mediarecorder/a;

    array-length v2, v0

    invoke-direct {v1, p1, v2}, Lcom/instagram/creation/video/mediarecorder/a;-><init>([BI)V

    .line 63
    array-length v2, v0

    invoke-virtual {v1, v0, v2}, Lcom/instagram/creation/video/mediarecorder/a;->a([BI)V

    .line 64
    const/4 v0, 0x0

    invoke-virtual {p0, v1, v0}, Lcom/instagram/creation/video/mediarecorder/m;->a(Lcom/instagram/creation/video/mediarecorder/a;Lcom/instagram/creation/video/mediarecorder/o;)V

    .line 65
    return-void

    .line 59
    :catch_0
    move-exception v0

    .line 60
    invoke-virtual {p2}, Lorg/json/JSONObject;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/String;->getBytes()[B

    move-result-object v0

    goto :goto_0
.end method


# virtual methods
.method public a(Lcom/instagram/creation/video/mediarecorder/a;Lcom/instagram/creation/video/mediarecorder/o;)V
    .locals 2
    .parameter
    .parameter

    .prologue
    .line 33
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/m;->a:Landroid/os/Handler;

    new-instance v1, Lcom/instagram/creation/video/mediarecorder/n;

    invoke-direct {v1, p0, p1, p2}, Lcom/instagram/creation/video/mediarecorder/n;-><init>(Lcom/instagram/creation/video/mediarecorder/m;Lcom/instagram/creation/video/mediarecorder/a;Lcom/instagram/creation/video/mediarecorder/o;)V

    invoke-virtual {v0, v1}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    .line 43
    return-void
.end method

.method public a()[B
    .locals 1

    .prologue
    .line 28
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/m;->b:Ljava/io/ByteArrayOutputStream;

    invoke-virtual {v0}, Ljava/io/ByteArrayOutputStream;->toByteArray()[B

    move-result-object v0

    return-object v0
.end method

.method public b()V
    .locals 2

    .prologue
    .line 48
    :try_start_0
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/m;->b:Ljava/io/ByteArrayOutputStream;

    invoke-virtual {v0}, Ljava/io/ByteArrayOutputStream;->flush()V

    .line 49
    iget-object v0, p0, Lcom/instagram/creation/video/mediarecorder/m;->b:Ljava/io/ByteArrayOutputStream;

    invoke-virtual {v0}, Ljava/io/ByteArrayOutputStream;->close()V
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    .line 53
    :goto_0
    return-void

    .line 50
    :catch_0
    move-exception v0

    .line 51
    const-string v0, "PacketWriter"

    const-string v1, "IOException while trying to release byte array from packet writer"

    invoke-static {v0, v1}, Lcom/facebook/e/a/a;->e(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_0
.end method
